package com.twinkle.bank;

/**
 * 信用卡账户
 */
public class CreditAccount extends Account implements IRepay {

    private int ceiling;

    public CreditAccount() {
        super();
    }

    public CreditAccount(String cardNo, String password, int balance, int ceiling) {
        super(cardNo, password, balance);
        this.ceiling = ceiling;
    }

    /**
     * @param money 取款金额
     */
    public void withdraw(int money) {
        if (balance + ceiling >= money) {
            balance -= money;
        }
    }

    /**
     * @param money 待还金额
     */
    @Override
    public void loan(int money) {
        if (balance >= money) {
            balance -= money;
        }
    }

    public int getCeiling() {
        return ceiling;
    }

    public void setCeiling(int ceiling) {
        this.ceiling = ceiling;
    }

}